<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./移动.css">
    <script src="./jquery-3.7.1.min.js"></script>
</head>

<body>
    <div id="box">
        <div class="one">
            <h3>可瑞多宇龙工匠店></h3>
        </div>
        <ul class="one1">
            <li>迷你蛋糕</li>
            <li>迷你蛋糕</li>
        </ul>
        <table style="width: 69% ;border: 1px solid rgb(177, 228, 240); float: left;">
            <tbody id="goods-list" style=" width: 720px;">
            </tbody>
        </table>
    </div>
    <script>
        $(function () {
            $('li').click(function () {
                $('li').css('background-color', '#f0f0f0')
                $('li').css('color', 'forestgreen')
                $(this).css('background-color', 'res')
                $('.con').html(con)
            })
        })
        let goodsList = [{
            photo: "https://n.sinaimg.cn/sinacn10101/625/w750h675/20200126/6ae7-innckcf7408378.jpg",
            pingjia: '草莓便当盒子',
            price: 14.8,
        }, {
            photo: "https://th.bing.com/th/id/R.7a11274e0fd40df486aabc265e5a31a4?rik=N8gpI6Qymm%2f3Vg&riu=http%3a%2f%2fi3.meishichina.com%2fattachment%2frecipe%2f2014%2f10%2f22%2fp800_201410221413964151319.jpg&ehk=g0weBIwf9moFwYerjddVJJNxZYx23xs%2ftGx51mIW3HU%3d&risl=&pid=ImgRaw&r=0",
            pingjia: '芒果便当盒子',
            price: 75,
        },
        {
            photo: "https://img.zcool.cn/community/01c1bd625842f90002c3290f4c6556.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100/quality,q_100",
            pingjia: '蓝莓便当盒子',
            price: 120,
        },
        {
            photo: "https://th.bing.com/th/id/R.0460fc3ce7e3806a3fc5668bc9998434?rik=g5wDnk1LhGEKOQ&riu=http%3a%2f%2fcp1.douguo.net%2fupload%2fcaiku%2f1%2fb%2fd%2fyuan_1bbd1cfa5b90adbee44e8d57e434229d.jpeg&ehk=5iORSVW7AAXdhNkQb1pnXva8GLmFW5JOaoHovk40v2w%3d&risl=&pid=ImgRaw&r=0",
            pingjia: '香草巧克力',
            price: 115,
        },
        {
            photo: "https://th.bing.com/th/id/R.97f8e5d657e44ea96e150091bf69085f?rik=V17YI9ap9qQN0w&riu=http%3a%2f%2fwww.wdmcake.com%2fimages%2fupload%2fImage%2f3%e7%bc%a4%e7%ba%b7%e7%9b%9b%e6%9e%9c%e8%9b%8b%e7%b3%95870.jpg&ehk=S9SrjbADdcdQjGAG9%2bkC0vr2QF8P6PBBTuVCq6KfCl4%3d&risl=&pid=ImgRaw&r=0",
            pingjia: '仲夏之恋',
            price: 100,
        },
        {
            photo: "https://img.zcool.cn/community/015cb75e11a3fea80120a89587e0db.jpg@1280w_1l_2o_100sh.jpg",
            pingjia: '加拉巴奥',
            price: 80,
        },
        ]
        // 购物加载
        function renderCart() {
            let cartContainer = document.getElementById('cart');
            cartContainer.innerHTML = '';
            cart.forEach(item => {
                let cartItem = document.createElement('tr');
                cartItem.innerHTML = `
                    <td><img src ="${item.photo}"></td>
                    <td>${item.one}</td>
                    <td>${item.price}</td>
                    <td>${item.stock}</td>
                    <td>${item.pingjia}</td>
                    <button onclick="removeItem('${item.name}')">删除</button>`;
                cartContainer.appendChild(cartItem);
            });
        }
        renderGoodsList();
        function renderGoodsList() {
            let goodsListContainer = document.getElementById('goods-list');
            goodsListContainer.innerHTML = '';
            goodsList.forEach(item => {
                let row = document.createElement('tr');
                row.innerHTML = `
                <ul>
                <li><img src ="${item.photo}">  
                    ${item.pingjia}<br>
                   <span>${item.price}</span>
                  <button onclick="addToCart('${item.name}')">+</button></li>
                </ul>`;
                goodsListContainer.appendChild(row);
            });
        }
    </script>
</body>

</html>